package com.wicket.okrdataassets.web.contorller;

import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.page.PageMethod;
import com.wicket.okrdataassets.biz.service.ResourceFileService;
import com.wicket.okrdataassets.biz.service.dto.req.*;
import com.wicket.okrdataassets.biz.service.dto.res.*;
import com.wicket.okrdataassets.common.ro.OkrResult;
import com.wicket.okrdataassets.common.util.CommonFunctionHelper;
import com.wicket.okrdataassets.integration.dto.DeleteResourceFileComReqDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/dataassets/resourceFile/")
public class ResourceFileController {

  @Autowired
  ResourceFileService resourceFileService;
/**
   * D8删除物理资源文件(公共)
   */
    @PostMapping("deletePhysicalResourceFileCom")
    public OkrResult<DeletePhysicalResourceFileComRespDto> deletePhysicalResourceFileCom(@RequestBody @Validated DeletePhysicalResourceFileComReqDto reqDTO){
    return OkrResult.success(resourceFileService.deletePhysicalResourceFileCom(reqDTO));
    }
/**
   * D8新增资源文件
   */
    @PostMapping("addResourceFile")
    public OkrResult<AddResourceFileRespDto> addResourceFile(@RequestBody @Validated AddResourceFileReqDto reqDTO){
    return OkrResult.success(resourceFileService.addResourceFile(reqDTO));
    }
/**
   * D8修改资源文件(公共)
   */
    @PostMapping("updateResourceFileCom")
    public OkrResult<UpdateResourceFileComRespDto> updateResourceFileCom(@RequestBody @Validated UpdateResourceFileComReqDto reqDTO){
    return OkrResult.success(resourceFileService.updateResourceFileCom(reqDTO));
    }
/**
   * D8新增存证记录(公共)
   */
    @PostMapping("addEviRecordCom")
    public OkrResult<AddEviRecordComRespDto> addEviRecordCom(@RequestBody @Validated AddEviRecordComReqDto reqDTO){
    return OkrResult.success(resourceFileService.addEviRecordCom(reqDTO));
    }
/**
   * D8删除资源文件(公共)
   */
    @PostMapping("deleteResourceFileCom")
    public OkrResult<DeleteResourceFileComRespDto> deleteResourceFileCom(@RequestBody @Validated DeleteResourceFileComReqDto reqDTO){
    return OkrResult.success(resourceFileService.deleteResourceFileCom(reqDTO));
    }
/**
   * D8查询存证记录详情(公共)
   */
    @PostMapping("queryEviRecordDetailCom")
    public OkrResult<QueryEviRecordDetailComRespDto> queryEviRecordDetailCom(@RequestBody @Validated QueryEviRecordDetailComReqDto reqDTO){
    return OkrResult.success(resourceFileService.queryEviRecordDetailCom(reqDTO));
    }
/**
   * D8查询资源文件详情(公共)
   */
    @PostMapping("queryResourceFileDetailCom")
    public OkrResult<QueryResourceFileDetailComRespDto> queryResourceFileDetailCom(@RequestBody @Validated QueryResourceFileDetailComReqDto reqDTO){
    return OkrResult.success(resourceFileService.queryResourceFileDetailCom(reqDTO));
    }
/**
   * D8查询资源文件列表(公共)
   */
    @PostMapping("queryResourceFileListCom")
    public OkrResult<QueryResourceFileListComRespDto> queryResourceFileListCom(@RequestBody @Validated QueryResourceFileListComReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryResourceFileListComRespDto retData = resourceFileService.queryResourceFileListCom(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }
/**
   * D8新增资源文件(公共)
   */
    @PostMapping("addResourceFileCom")
    public OkrResult<AddResourceFileComRespDto> addResourceFileCom(@RequestBody @Validated AddResourceFileComReqDto reqDTO){
    return OkrResult.success(resourceFileService.addResourceFileCom(reqDTO));
    }
/**
   * D8循环增资源文件
   */
    @PostMapping("loopAddResourceFile")
    public OkrResult<LoopAddResourceFileRespDto> loopAddResourceFile(@RequestBody @Validated LoopAddResourceFileReqDto reqDTO){
    return OkrResult.success(resourceFileService.loopAddResourceFile(reqDTO));
    }
/**
   * D8执行资源文件上区块链(公共)
   */
    @PostMapping("implementEviFilesChainsCom")
    public OkrResult<ImplementEviFilesChainsComRespDto> implementEviFilesChainsCom(@RequestBody @Validated ImplementEviFilesChainsComReqDto reqDTO){
    return OkrResult.success(resourceFileService.implementEviFilesChainsCom(reqDTO));
    }
/**
   * D8分析资源文件归属对象名称(公共)
   */
    @PostMapping("analysisResourceFileObjectNameCom")
    public OkrResult<AnalysisResourceFileObjectNameComRespDto> analysisResourceFileObjectNameCom(@RequestBody @Validated AnalysisResourceFileObjectNameComReqDto reqDTO){
    return OkrResult.success(resourceFileService.analysisResourceFileObjectNameCom(reqDTO));
    }
/**
   * D8执行存证操作权限判断(公共)
   */
    @PostMapping("implementEviRecordOperatePrivacyCom")
    public OkrResult<ImplementEviRecordOperatePrivacyComRespDto> implementEviRecordOperatePrivacyCom(@RequestBody @Validated ImplementEviRecordOperatePrivacyComReqDto reqDTO){
    return OkrResult.success(resourceFileService.implementEviRecordOperatePrivacyCom(reqDTO));
    }
/**
   * D8生成智能简介(公共)
   */
    @PostMapping("generateSmartIntroCom")
    public OkrResult<GenerateSmartIntroComRespDto> generateSmartIntroCom(@RequestBody @Validated GenerateSmartIntroComReqDto reqDTO){
    return OkrResult.success(resourceFileService.generateSmartIntroCom(reqDTO));
    }
/**
   * D8执行新增资源文件(公共)
   */
    @PostMapping("implementResourceFileCom")
    public OkrResult<ImplementResourceFileComRespDto> implementResourceFileCom(@RequestBody @Validated ImplementResourceFileComReqDto reqDTO){
    return OkrResult.success(resourceFileService.implementResourceFileCom(reqDTO));
    }
}
